package com.santu.edu.supporter.biz.category.pojo.dto;

import com.santu.edu.supporter.biz.category.pojo.params.GoodCategoryAddParam;
import com.santu.edu.supporter.biz.category.pojo.params.GoodCategoryUpdateParam;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @author luoyaoqi
 * @createTime 2024/3/12
 * @description
 */
@Data
@Accessors(chain = true)
public class GoodCategoryDTO {

    /**
     * 类别id
     */
    private String categoryId;

    /**
     * 类别名称
     */
    private String categoryName;

    /**
     * 顺序
     */
    private Integer sort;

    public static GoodCategoryDTO createItem(String categoryId, GoodCategoryAddParam addParam) {
        return new GoodCategoryDTO()
                .setCategoryId(categoryId)
                .setCategoryName(addParam.getCategoryName())
                .setSort(addParam.getSort());
    }
    public static GoodCategoryDTO createItem(GoodCategoryUpdateParam updateParam) {
        return new GoodCategoryDTO()
                .setCategoryId(updateParam.getCategoryId())
                .setCategoryName(updateParam.getCategoryName())
                .setSort(updateParam.getSort());
    }
}
